feat(config): add pull metric reader support to declarative config#5216
Merged
lzchen merged 11 commits intoMay 19, 2026
Merged
Conversation
Implements PullMetricReader and PullMetricExporter support in declarative file configuration: - _create_prometheus_metric_reader() — dynamically imports PrometheusMetricReader, maps config fields (host, port, without_target_info_development), and starts HTTP server - _create_pull_metric_exporter() — dispatches to prometheus or loads plugin readers via opentelemetry_pull_metric_exporter entry point group - _create_pull_metric_reader() — handles producers (warns, open-telemetry#5074) and cardinality_limits (warns), delegates to exporter factory producers and cardinality_limits log warnings as not yet supported. Assisted-by: Claude Opus 4.6
23 tasks
Remove redundant 'or False' from bool() conversion. Assisted-by: Claude Opus 4.6
Add provider assertions so test methods use self, satisfying pylint's no-self-use check. Assisted-by: Claude Opus 4.6
herin049
approved these changes
May 15, 2026
- Add PrometheusMetricExporterConfig type annotation to _create_prometheus_metric_reader config parameter - Assert entry_points is called with the correct group name (opentelemetry_pull_metric_exporter) in plugin loading test Assisted-by: Claude Opus 4.6
herin049
approved these changes
May 19, 2026
Contributor
|
Looks like lint is failing. |
The merge brought in push exporter plugin tests from open-telemetry#5128 which ended up in TestCreatePullMetricReaders. Moved them to a new TestCreateMetricReadersGeneral class with the _make_periodic_config helper they need. Assisted-by: Claude Opus 4.6
…into mike/config-pull-metric-reader
lzchen
approved these changes
May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds pull metric reader support to declarative file configuration, including Prometheus metric reader via the
prometheus_developmentconfig field.Previously,
_create_metric_reader()raisedConfigurationErrorfor anypullreader config. Now it dispatches to new factory functions that handle both the built-in Prometheus reader and plugin-based pull readers.How it works
Prometheus (
prometheus_development):PrometheusMetricReaderandstart_http_serverfromopentelemetry-exporter-prometheus(same try/except pattern as OTLP exporters)without_target_info_development→disable_target_info,host/port→start_http_server()without_scope_info,with_resource_constant_labelsPlugin pull readers:
additional_propertiesare loaded viaload_entry_point("opentelemetry_pull_metric_exporter", name)(**(config or {}))Not yet supported (warnings logged):
producers— SDK doesn't have MetricProducer support yet (feat(config): add pull metric reader support to declarative config #5074)cardinality_limits— deferredDesign note
Pull "exporters" like Prometheus are combined reader+exporter objects —
PrometheusMetricReaderIS aMetricReader. The_create_pull_metric_exporter()function returns aMetricReader, matching the config schema's terminology while reflecting the SDK's class hierarchy.Example config
Tests
8 new tests covering: prometheus creation with config, defaults, missing package, no exporter, plugin loading, plugin not found, producers warning, cardinality_limits warning.
Closes #5073